<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../bootstrap-table/bootstrap.min.css" />
<link rel="stylesheet" href="../../bootstrap-table/bootstrap-table.css">
<link rel="stylesheet" href="../../css/top.css" />
<link rel="stylesheet" href="../../css/home.css" />
<link rel="stylesheet" href="../../font-awesome-4.6.3/css/font-awesome.min.css" />
<link rel="stylesheet" href="../../css/dropkick.css" type="text/css">
<link rel="stylesheet" href="../../css/blank_theme.css" type="text/css">
<script src="../../js/jquery.min.js"></script>
<script src="../../js/top.js"></script>
<script src="../../js/home.js"></script>
<script src="../../js/jquery.dropkick-min.js"></script>
<script src="../../bootstrap-table/bootstrap-table.js"></script>
<script src="../../bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<title>智行校园</title>
<style>
  div.table_groups ul a{
     color:#000;
     font-weight:100
  }
  div.table_groups div span{
     display: inline-block;
  }
  a.dk_toggle {
     min-width:13em
  }
</style>
</head>
<body >
    <input  type="hidden" value="我的主页"  />
    <div style="height:100%;width:calc((100% - 15em)*0.63 - 3px + 4.5em);background:white"></div>
	<div class="container" style="margin-top:0px">
        <div class="main_lcontainer " >
             <a class="return_home" href="/WDDXSERVER/home.jsp"> <img src="../../img/syxq-tb_03.png"/>&#12288返回首页</a>
             <ul class="xxjh_detials">
                 <li class="visited"><a href="#div_xxjh"><img src="../../img/syxq-tb_10.png">学习计划</a></li>
                 <li><a href="#div_wdcj"><img src="../../img/syxq-tb_12.png">我的成绩</a></li>
                 <li><a href="#div_gkyj"><img src="../../img/syxq-tb_14.png">挂科预警</a></li>
             </ul>
             <div class="table_groups">
               <div id="div_xxjh">
                 <span name="xq">
                    <select  class="default " tabindex="1"></select>
                 </span>
                 <span name="kcxz" >
                   <select  class="default" tabindex="2"></select>
                 </span>
                 <table id="table_xxjh"></table>
               </div>
               <div id="div_wdcj" >
                <span name="xnxq">
                    <select  class="default" tabindex="3"></select>
                 </span>
                 <table id="table_wdcj"></table>
               </div>
               <div id="div_gkyj" >
                 <table id="table_gkyj"></table>
               </div>
             </div>
        </div>
        <div class="main_rcontainer">
           <div class="main_rtcontainer">
               <img src="../../img/rili_new.png">
               <div class="clear"></div>
           </div>
           <div class="main_rbcontainer">
              <div class="message_header">
                 <a href="#"><h3> 消息 </h3>（5）</a>
                 <a href="#">查看更多. . .</a>
              </div>

           </div>
        </div>
		<div class="clear"></div>
	</div>

	<footer>
	<div class="footer_left" style="height: 4.5em"></div>
	<div class=" footer_right" style="height: 4.5em">
		<div class="left_div">
			<button id="footer_toggle" class="footer_up"></button>
		</div>
		<div class="right_div">
			<label><img class="footer_scan" src="../../img/erweima.png" />智行校园APP</label>
			<label class="change"><font size="4">智行校园APP</font></br>我最忠实的好友 <img
				src="../../img/erweima.png" /></label>
		</div>
	</div>
	</footer>
	<div id="myFunction">
		<div class="dialog"></div>
		<div class="my_dialog">
			<h3 class="function_header">管理我的应用
			   <i class="fa fa-times" style="float:right;margin-right:1em;cursor:pointer;margin-top:0.4em"></i></h3>
			<button class="function_finish">提交</button>
			<div class="dialog_content">
				<div class="my_function"></div>
				<div class="other_function"></div>
			</div>
		</div>
	</div>
	 <form method="post" name="home_form">
		 <input type="hidden" value="" name="userid" />
	 </form>
	<script>
	var user_id = '<%=session.getAttribute("userid")%>';
	var user_name = '<%=session.getAttribute("username")%>';
	var faceaddress = '<%=session.getAttribute("faceaddress")%>';
	var ticket = '<%=session.getAttribute("ticket")%>';
	var type='<%=request.getParameter("xijh_type")%>';
	$('body').append(' <input id="user_id" style="display:none" value="'+user_id+'"  />');
	$('form[name="home_form"] input:hidden').attr('value',user_id);
	var colums=[["class_name","class_type","class_score","class_credit"],
	                  ["课程名称","类别","成绩","学分"]];
	$(function(){
		paint_main();
		$('ul.xxjh_detials li a').click(function(){
			$(this).parent().addClass('visited').siblings().removeClass('visited');
			var id=$(this).attr('href');
		    $('div.table_groups  '+ id).css('display','block').siblings().css('display','none');
			return false;
		});
		$('div.lbcontainer a,div.rccontainer a.search_info,div.ltcontainer a').click(function(event){
			$('form[name="home_form"]').attr('action',$(this).attr('href'));
			$('form[name="home_form"]').submit();
			return false;
	    });
		$('ul.xxjh_detials li:contains('+type+')').addClass('visited').siblings().removeClass('visited');
		$($('ul.xxjh_detials li.visited a').attr('href')).siblings().css('display','none');
	})

	 function table_maker(id,url,colums,param){
		$.getJSON(url,param,function(data){
			 var colum=[];
		     for(var i=0;i<colums[0].length;i++)
		    		colum[i]={field:colums[0][i],title:colums[1][i],valign:"middle",align:"center"};
			 $(id).bootstrapTable({
					data : data,
					columns : colum,
					sidePagination : 'client',
					pagination : true,
					pageSize : 9,
					search : false,
					searchOnEnterKey : true,
					locale : 'zh-CN'
				});
		})
		
	 };
	 
	 function table_maker2(id,url,colums,param){
			$.getJSON(url,param,function(data){
				data = data[0].content.message.items;
				 var colum=[];
			     for(var i=0;i<colums[0].length;i++)
			    		colum[i]={field:colums[0][i],title:colums[1][i],valign:"middle",align:"center"};
				 $(id).bootstrapTable({
						data : data,
						columns : colum,
						sidePagination : 'client',
						pagination : true,
						pageSize : 9,
						search : false,
						searchOnEnterKey : true,
						locale : 'zh-CN'
					});
			})
			
		 };
		 
		 function table_maker3(id,url,colums,param){
				$.getJSON(url,param,function(data){
					data = data[0].content.message;
					//alert(JSON.stringify(data));
					 var colum=[];
				     for(var i=0;i<colums[0].length;i++)
				    		colum[i]={field:colums[0][i],title:colums[1][i],valign:"middle",align:"center"};
					 $(id).bootstrapTable({
							data : data,
							columns : colum,
							sidePagination : 'client',
							pagination : true,
							pageSize : 9,
							search : false,
							searchOnEnterKey : true,
							locale : 'zh-CN'
						});
				})
				
			 };	 
		 
	 function select_change(url,id,param){
		 $.getJSON(url,param,function(data){
			 var $the_select=$('div.table_groups span[name="'+id+'"] select');
			 $the_select.empty();
			 var str=[];
			 var data=data.kcxz;
			 var length=data.length;
			 for(var i=0;i<length;i++)
				 str[i]=' <option value="'+data[i].rm_kcxz+'">'+data[i].kcxz+'</option>';
			 $the_select.append(str.join(''));
			 $the_select.dropkick('refresh');
		});
	 };
	 function paint_main(){
		 $.getJSON('/WDDXSERVER/home/getCJForPcDefault?callback=?',{userid:user_id,ticket:ticket},function(data){
			 var $select=$('div.table_groups span[name="xnxq"] select');
			 var str=[];
			 var data=data.content.message.items;
			 var length=data.length;
			 for(var i=0;i<length;i++)
				 str[i]=' <option value="'+data[i].rm_xq+'">'+data[i].xnxq+'</option>';
			 $select.append(str.join(''));
			 $select.dropkick({
				 change: function (value, label) {
					 $('#table_wdcj').bootstrapTable('destroy');
					 table_maker2('#table_wdcj','/WDDXSERVER/home/getCJForPc?callback=?',colums,{userid:user_id,rm_xq:value,ticket:ticket});
			      }
			 });
			 table_maker2('#table_wdcj','/WDDXSERVER/home/getCJForPc?callback=?',colums,{userid:user_id,rm_xq:data[0].rm_xq,ticket:ticket});
		});
		
		$.getJSON('/WDDXSERVER/home/getXXJHDefault?callback=?',{userid:user_id,ticket:ticket},function(data){
			 var str1=[];
			 var str2=[];
			 data = data.content.message;
			 var data1=data.xq,data2=data.kcxz;
			 var length1=data1.length,length2=data2.length;
			 for(var i=0;i<length1;i++)
				 str1[i]=' <option value="'+data1[i].rm_xq+'">'+data1[i].value+'</option>';
		     $('div.table_groups span[name="xq"] select').append(str1.join(''));
			 for(var j=0;j<length2;j++)
				 str2[j]=' <option value="'+data2[j].rm_kcxz+'">'+data2[j].value+'</option>';
			 $('div.table_groups span[name="kcxz"] select').append(str2.join(''));
			 $('div.table_groups span[name="xq"] select').dropkick({
				 change: function (value, label) {
					 select_change('/WDDXSERVER/home/getXXJHOp?callback=?','kcxz',{userid:user_id,rm_xq:value,ticket:ticket});
					 $('#table_xxjh').bootstrapTable('destroy');
					 table_maker3('#table_xxjh','/WDDXSERVER/home/getXXJHForPc?callback=?',colums,{userid:user_id,rm_xq:value,rm_kcxz:'',ticket:ticket});
			      }
			 });
			 $('div.table_groups span[name="kcxz"] select').dropkick({
				 change: function (value, label) {
					 $('#table_xxjh').bootstrapTable('destroy');
					 var the_value=$('div.table_groups span[name="xq"] li.dk_option_current a').attr('data-dk-dropdown-value');
					 table_maker3('#table_xxjh','/WDDXSERVER/home/getXXJHForPc?callback=?',colums,{userid:user_id,rm_xq:the_value,rm_kcxz:value,ticket:ticket});
			      }
			});
		 table_maker3('#table_xxjh','/WDDXSERVER/home/getXXJHForPc?callback=?',colums,{userid:user_id,rm_xq:data1[0].rm_xq,rm_kcxz:'',ticket:ticket});
		});
		table_maker('#table_gkyj','/WDDXSERVER/home/getGK?callback=?',colums,{userid:user_id,ticket:ticket});
	 }
	 
	</script>
</body>
</html>